﻿@model Leads360Express.Repository.Pages.User.UserModel
<fieldset>
    <div class="content" style="position: relative;">
        <h2 class="app">
            <strong>Manage Users</strong>
            @Html.Partial("_PatialLeads_Calls", @Model.LeadCall )
        </h2>

        <div class="title nomargin">
        <span class="right-btns">
            <span id="SearchInput"><input id="searchKeyword" type="text" class="text spl search filter" value="Search Users" style="margin-top:-1px;" /></span>
            <a href="#" class="btn btn-go" data-bind="click:SearchButton">Go</a>
            <span class="v-line"></span>
            <a href="#" class="btn btn-addnewuser" data-bind="click:AddNewBtnClick">Add new user</a>
        </span>
        <h3>
            Licenses:&nbsp;<span style="font-weight:normal;" data-bind="text:NumberOfLicenses"></span>
            <span style="font-weight:normal;">&nbsp;|&nbsp;</span>
            Users:&nbsp;<span style="font-weight:normal;" data-bind="text:NumberOfUsers"></span>
        </h3>
        </div>
        <div data-bind="visible:ShowResultSearch">
            <span class="paging">
                <span class="show ">Show <input type="text" class="text" id="pagesize" data-bind="value: PageSize, attr: {maxlength: 3}" onkeypress="return isNumberKey(event)" value="10" /> per page <span class="smallText" data-bind="text: PageSizeText"></span> </span>
                <span class="pages"><span class="smallText" data-bind="text: PageCurrentText"></span>Page <input type="text" class="text" id="pagecurrent" data-bind="value: CurrentPageIndex, attr: {maxlength: 4}" onkeypress="return isNumberKey(event)" value="1" /> of <span data-bind="text: MaxPageIndex"></span>
                    <a href="#" data-bind="click: PreviousPage, attr: {'class': PrevButtonClass}">Prev</a>
                    <a href="#" data-bind="click: NextPage, attr: {'class': NextButtonClass}">Next</a>
                </span>
            </span>
            <div class="table table-leads manageusers">
                <div class="title">
                    <div class="col1" data-bind="click: function(event) { SetOrder(event, 'Name') }">
                        <span class="w" style="min-height:11px">
                            <a href="#">Name</a>
                            <div class="sort_wrapper" id="Name">
                                <span class="grid_order ui_icon"></span>
                            </div>
                        </span>
                    </div>
                    <div class="col1 col2" data-bind="click: function(event) { SetOrder(event, 'Email') }">
                        <span class="w" style="min-height:11px">
                            <a href="#">Email</a>
                            <div class="sort_wrapper" id="Email">
                                <span class="grid_order ui_icon"></span>
                            </div>
                        </span>
                    </div>
                    <!--<div class="col1 col2"><span class="w"><a href="#" data-bind="click:OrderEmail">Email</a></span></div>-->
                    <div class="col1 col3"><span class="w" style="min-height:11px">Receiving Leads</span></div>
                    <div class="col1 col4"><span class="w" style="min-height:11px">Receiving Calls</span></div>
                    <div class="col1 col5"><span class="w" style="min-height:11px">Roles</span></div>
                    <div class="col1 col12 centeralign"><span class="w" style="min-height:11px">Delete</span></div>
                </div>
                <div data-bind="template: { foreach: itemsOnCurrentPage, afterRender: refreshRowLinks }">
                    <div class="line">
                        <div class="col1"><span class="w" style="min-height:24px; height:24px;"><a data-bind="attr: { href: '/User/Edit/' + UserId, value: '##' + Name }" class="email_link"><span data-bind="text: Name"></span></a></span></div>
                        <div class="col1 col2"><span class="w" style="min-height:24px;" data-bind="text: Email"></span></div>
                        <div class="col1 col3">
                            <span class="w" style="min-height:24px; height:24px;">
                                <a data-bind="attr: { rel: ReceivingLead + '', 'class': ReceivingLead ? 'btn toggle-on enable receiving' : 'btn toggle-off enable receiving', href: '##' + UserId, id: 'toggle-lead' + UserId }"></a>
                            </span>
                        </div>
                        <div class="col1 col4">
                            <span class="w" style="min-height:24px; height:24px;">
                                <a data-bind="attr: { rel: ReceivingCall + '', 'class': ReceivingCall ? 'btn toggle-on enable receiving' : 'btn toggle-off enable receiving', href: '##' + UserId, id: 'toggle-call' + UserId }"></a>
                            </span>
                        </div>
                        <div class="col1 col5" style="min-height:24px; height:24px;"><span class="w" data-bind="text: Role"></span></div>
                        <div class="col1 col12 centeralign">
                            <span class="w" style="min-height:24px; height:24px;">
                                <div data-bind="if: Role=='User'">
                                    <a href="javascript:void(0)" data-bind="attr: { id: 'user_' + UserId, rel: Name, onclick: 'OpenReassignLead(' + UserId + ')' }" class="btn btn-x">Delete</a>
                                </div>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel" data-bind="visible:ShowNoResult">
            <div class="error-msg"><span data-bind="text:SearchKeyWord"></span></div>
        </div>

        @Html.Partial("_Footer.Copyright")
    </div><!-- //.content -->

    @Html.Partial("_DeleteConfirmUser")
    @Html.Partial("_NewUserAlert")
    @Html.Partial("_AlertTooManyUsers")
    @Html.Partial("_DeletePermanent")
</fieldset>
